package com.c.async;

import java.util.concurrent.Future;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component("AsyncTask")
public class AsyncTask {

	@Async
	public void doSomeHeavyBackgroundTask() {
		try {
			System.out.println("执行1");
			Thread.sleep(5000);
			System.out.println("执行1完成。。");
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public void printLog() {
		System.out.println("执行2");
	}
}
